local extension = Package("jlve_2")
extension.extensionName = "jlve"

Fk:loadTranslationTable{

}

local U = require "packages/utility/utility"
local T = require "packages/jlve/record/Theorem"



local luolei = fk.CreateTriggerSkill{
    name = "jlve__luolei",
    anim_type = "offensive",
    events = {fk.CardUsing, fk.CardResponding},
    can_trigger = function(self, event, target, player, data)
      return player:hasSkill(self) and target == player and data.card.name == "jink"
    end,
    on_cost = function(self, event, target, player, data)
      local to = player.room:askForChoosePlayers(player, table.map(player.room:getOtherPlayers(player), function (p)
        return p.id end), 1, 1, "#jlve__luolei-choose", self.name, true)
      if #to > 0 then
        self.cost_data = to[1]
        return true
      end
    end,
    on_use = function(self, event, target, player, data)
      local room = player.room
      local tar = room:getPlayerById(self.cost_data)
      local judge = {
        who = tar,
        reason = self.name,
        pattern = ".|.|spade",
      }
      room:judge(judge)
      if judge.card.suit == Card.Spade then
        room:damage{
          from = player,
          to = tar,
          damage = 2,
          damageType = fk.ThunderDamage,
          skillName = self.name,
        }
      end
  end,
}
Fk:addSkill(luolei)
Fk:loadTranslationTable{
    ["jlve__luolei"] = "落雷",
    [":jlve__luolei"] = "当你使用或打出【闪】时，你可以令一名角色进行判定，若结果为♠，你对其造成2点雷电伤害。",
    ["#jlve__luolei-choose"] = "落雷：你可以令一名角色进行判定，若为♠，你对其造成2点雷电伤害。",
}
local zhoufu = fk.CreateTriggerSkill{
    name = "jlve__zhoufu",
    anim_type = "control",
    events = {fk.TurnStart},
    can_trigger = function(self, event, target, player, data)
      return player:hasSkill(self) and target ~= player and not player:isKongcheng()
    end,
    on_cost = function(self, event, target, player, data)
      local card = player.room:askForDiscard(player,1,1,false, self.name, true, ".","#jlve__zhoufu-ask::" .. target.id, true)
      if #card > 0 then
        self.cost_data = card
        return true
      end
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        room:moveCardTo(self.cost_data, Card.DiscardPile, player, fk.ReasonDiscard, self.name)
        local judge = {
            who = target,
            reason = self.name,
            pattern = ".|.|spade,club",
        }
        room:judge(judge)
        if judge.card.suit == Card.Spade then
            room:setPlayerMark(target,"@@jlve__zhoufu-turn",1)
        elseif judge.card.suit == Card.Club then
            if not target:isNude() then
                room:askForDiscard(target,2,2,true,self.name,false)
            end
        end
    end,
}
local zhoufu_invalidity = fk.CreateInvaliditySkill {
    name = "#jlve__zhoufu_invalidity",
    invalidity_func = function(self, from, skill)
      return from:getMark("@@jlve__zhoufu-turn") > 0 and not skill.attached_equip and not skill.name:endsWith("&")
    end
}
zhoufu:addRelatedSkill(zhoufu_invalidity)
Fk:addSkill(zhoufu)
Fk:loadTranslationTable{
    ["jlve__zhoufu"] = "咒符",
    [":jlve__zhoufu"] = "其他角色回合开始时，你可弃置一张牌令其进行一次判定，若判定结果为♠，其本回合所有技能无效，若为♣，其弃置两张牌",
    ["#jlve__zhoufu-ask"] = "咒符：你可以弃置一张牌令 %dest 进行一次判定，若为♠，其本回合失去所有技能，若为♣，其弃置两张牌",
    ["@@jlve__zhoufu-turn"] = "咒符封技",
    ["#jlve__zhoufu_invalidity"] = "咒符",
}
local shendao = fk.CreateTriggerSkill{
    name = "jlve__shendao",
    anim_type = "control",
    events = {fk.AskForRetrial},
    can_trigger = function(self, event, target, player, data)
      return player:hasSkill(self) 
    end,
    on_cost = function(self, event, target, player, data)
      local room = player.room
      local tars = {}
      for _, p in ipairs(room.alive_players) do
        if #p:getCardIds("ej") > 0 then
            table.insert(tars,p.id)
        end
      end
      local tar = room:askForChoosePlayers(player,tars,1,1,"#jlve__shendao1::" .. target.id .. ":" .. data.reason,self.name,true)
      if #tar > 0 then
        local card = room:askForCardChosen(player,room:getPlayerById(tar[1]),"ej",self.name,"#jlve__shendao2::" .. target.id .. ":" .. data.reason)
        if card then
            self.cost_data = {Fk:getCardById(card),true}
            return true
        end
      else
        local card = player.room:askForResponse(player, self.name, ".|.|.|hand", "#jlve__shendao3::" .. target.id .. ":" .. data.reason, true)
        if card ~= nil then
            self.cost_data = {card}
            return true
        end
      end
      
    end,
    on_use = function(self, event, target, player, data)
      if self.cost_data[2] then
        player.room:obtainCard(player.id,self.cost_data[1].id, false, fk.ReasonPrey)
        if player.room:getCardOwner(self.cost_data[1].id) == player and player.room:getCardArea(self.cost_data[1].id) == Player.Hand then
          player.room:retrial(self.cost_data[1], player, data, self.name, true)
        end
      else
        player.room:retrial(self.cost_data[1], player, data, self.name, true)
      end
    end,
}
Fk:addSkill(shendao)
Fk:loadTranslationTable{
    ["jlve__shendao"] = "神道",
    [":jlve__shendao"] = "当一名角色的判定牌生效前，你可以打出一张手牌或用场上的一张牌替换之。",
    ["#jlve__shendao1"] = "神道：选择一名角色装备区或判定区的一张牌替换 %dest 的 “%arg” 判定，或点击取消打出手牌替换。",
    ["#jlve__shendao2"] = "神道：选择一张牌替换 %dest 的 “%arg” 判定",
    ["#jlve__shendao3"] = "神道：你可以打出一张手牌替换 %dest 的 “%arg” 判定",
}

local jijun = fk.CreateActiveSkill{
    name = "jlve__jijun",
    anim_type = "special",
    min_card_num = 1,
    target_num = 0,
    prompt = "#jlve__jijun",
    expand_pile = "jlve__bing",
    can_use = function(self, player)
      return  player:usedSkillTimes(self.name, Player.HistoryPhase) == 0
    end,
    target_filter = Util.FalseFunc,
    card_filter = function(self, to_select, selected)
        if #selected == 4 or Fk:currentRoom():getCardArea(to_select) ~= Player.Hand then return false end
        if #selected == 0 then
            return true
          else
            return table.every(selected, function(id) return Fk:getCardById(to_select).suit ~= Fk:getCardById(id).suit end)
        end
    end,
    on_use = function(self, room, effect)
      local player = room:getPlayerById(effect.from)
      local suit = {}
      for _, cid in ipairs(effect.cards) do
        local c = Fk:getCardById(cid)
        table.insertIfNeed(suit,c.suit)
      end
      local cards = {}
      if #player:getPile("jlve__bing") > 0 then
        for _, cid in ipairs(player:getPile("jlve__bing")) do
            local c = Fk:getCardById(cid)
            if table.contains(suit,c.suit) then
                table.insert(cards,cid)
            end
        end
      end
      player:addToPile("jlve__bing", effect.cards, true, self.name)
      if player.dead then return end
      room:moveCardTo(cards, Card.PlayerHand, player, fk.ReasonPrey, self.name)
      if not player.dead and  player:hasSkill("jlve__fangtong") then 
      local skills = player:getMark("jlve__jijun")
      room:setPlayerMark(player, "jlve__jijun", 0)
      if skills and skills ~= 0 and type(skills) == "table" then
        for _, s in ipairs(skills) do
            if Fk.skills[s] and player:hasSkill(s) then
            room:handleAddLoseSkills(player,"-"..s, nil, true)
            end
        end
      end
      local num = 0
      if #player:getPile("jlve__bing") > 0 then
      for _, cid in ipairs(player:getPile("jlve__bing")) do
        num = num + Fk:getCardById(cid).number
      end
      local mark = {}
      if num >= 9 then
        table.insert(mark,"jlve__luolei")
        room:handleAddLoseSkills(player,"jlve__luolei", nil, true)
      end
      if num >= 18 then
        table.insert(mark,"jlve__zhoufu")
        room:handleAddLoseSkills(player,"jlve__zhoufu", nil, true)
      end
      if num >= 27 then
        table.insert(mark,"jlve__shendao")
        room:handleAddLoseSkills(player,"jlve__shendao", nil, true)
      end
      if num >= 36 then
        table.insert(mark,"jlve__biantian")
        room:handleAddLoseSkills(player,"jlve__biantian", nil, true)
      end
      room:setPlayerMark(player, "jlve__jijun", mark)
      end
      room:notifySkillInvoked(player,"jlve__fangtong","special")
      player:broadcastSkillInvoke("jlve__fangtong")
      end
      if player.dead then return end
      U.askForUseVirtualCard(room, player, U.getAllCardNames("b"), nil, self.name, "#jlve__jijun-ask", true, true, true, false)
    end,
}
Fk:loadTranslationTable{
    ["jlve__jijun"] = "集军",
    [":jlve__jijun"] = "出牌阶段限一次，你可以将任意张花色不同的手牌置于你的武将牌上，称为“兵”，若为“兵”中已有的花色，则改为替换之；然后你可以视为使用一张无距离次数限制的基本牌。",
    ["#jlve__jijun"] = "你可以将任意花色不同的手牌置入“兵”，若为“兵”已有的花色则改为与之替换",
    ["#jlve__jijun-ask"] = "集军：你可以视为使用一张无距离次数限制的基本牌。",
    ["$jlve__jijun1"] = "呵呵呵呵，天下万民，皆可为我所用。",
    ["$jlve__jijun2"] = "星星之火，亦可成燎原之势。",
    ["jlve__bing"] = "兵",
}
local fangtong = fk.CreateTriggerSkill{
    name = "jlve__fangtong",
    anim_type = "drawcard",
    frequency = Skill.Compulsory,
    events = {fk.TurnEnd},
    can_trigger = function(self, event, target, player, data)
        if target == player and player:hasSkill(self) then
            if #player:getPile("jlve__bing") then
                local num = 0
                for _, cid in ipairs(player:getPile("jlve__bing")) do
                    num = num + Fk:getCardById(cid).number
                end
                local n = 0
                if num >= 36 then
                    n = 4
                elseif num >= 27 then
                    n = 3
                elseif num >= 18 then
                    n = 2
                elseif num >= 9 then
                    n = 1
                end
                self.cost_data = n
                return player:getHandcardNum() < n
            end
        end
    end,
    on_use = function(self, event, target, player, data)
      player:drawCards(self.cost_data - player:getHandcardNum())
    end,
    refresh_events = {fk.EventAcquireSkill,fk.EventLoseSkill},
    can_refresh = function(self, event, target, player, data)
    return player == target and data == self 
    end,
    on_refresh = function(self, event, target, player, data)
      local room = player.room
    if event == fk.EventAcquireSkill then
      local skills = player:getMark("jlve__jijun")
      room:setPlayerMark(player, "jlve__jijun", 0)
      if skills and skills ~= 0 and type(skills) == "table" then
        for _, s in ipairs(skills) do
            if Fk.skills[s] and player:hasSkill(s) then
            room:handleAddLoseSkills(player,"-"..s, nil, true)
            end
        end
      end
      local num = 0
      if #player:getPile("jlve__bing") > 0 then
      for _, cid in ipairs(player:getPile("jlve__bing")) do
        num = num + Fk:getCardById(cid).number
      end
      local mark = {}
      if num >= 9 then
        table.insert(mark,"jlve__luolei")
        room:handleAddLoseSkills(player,"jlve__luolei", nil, true)
      end
      if num >= 18 then
        table.insert(mark,"jlve__zhoufu")
        room:handleAddLoseSkills(player,"jlve__zhoufu", nil, true)
      end
      if num >= 27 then
        table.insert(mark,"jlve__shendao")
        room:handleAddLoseSkills(player,"jlve__shendao", nil, true)
      end
      if num >= 36 then
        table.insert(mark,"jlve__biantian")
        room:handleAddLoseSkills(player,"jlve__biantian", nil, true)
      end
      room:setPlayerMark(player, "jlve__jijun", mark)
      end
      room:notifySkillInvoked(player,"jlve__fangtong","special")
      player:broadcastSkillInvoke("jlve__fangtong")
    elseif event == fk.EventLoseSkill then
      local skills = player:getMark("jlve__jijun")
      room:setPlayerMark(player, "jlve__jijun", 0)
      if skills and skills ~= 0 and type(skills) == "table" then
        for _, s in ipairs(skills) do
            if Fk.skills[s] and player:hasSkill(s) then
            room:handleAddLoseSkills(player,"-"..s, nil, true)
            end
        end
      end
    end
  end,
}
Fk:loadTranslationTable{
    ["jlve__fangtong"] = "方统",
    [":jlve__fangtong"] = "锁定技；根据你的“兵”点数和视为拥有以下技能：<br>不小于9，拥有〖落雷〗;<br>不小于18，拥有〖咒符〗；<br>不小于27，拥有〖神道〗;<br>不小于36，拥有〖变天〗；<br>你的回合结束时，将手牌补至〖方统〗满足的技能数。",
    ["$jlve__fangtong1"] = "黄巾36方，当一统天下。",
    ["$jlve__fangtong2"] = "奉黄天之命，可统36方。",
}
local zhangliang = General(extension, "jlve__zhangliang","qun",3,3)
zhangliang:addSkill(jijun)
zhangliang:addSkill(fangtong)
zhangliang:addRelatedSkill("jlve__luolei")
zhangliang:addRelatedSkill("jlve__zhoufu")
zhangliang:addRelatedSkill("jlve__shendao")
zhangliang:addRelatedSkill("jlve__biantian")
Fk:loadTranslationTable{
    ["jlve__zhangliang"] = "张梁",

    ["~jlve__zhangliang"] = "黄天之道，我已无颜相见。",
}

local huituo_active = fk.CreateActiveSkill{
  name = "jlve__huituo_active",
  card_num = 0,
  prompt = "恢拓：选择一名角色执行选项。",
  target_num = 1,
  card_filter = Util.FalseFunc,
  target_filter = function(self, to_select, selected)
      return  #selected == 0 
  end,
  interaction = function(self)
    local mark = type(Self:getMark("jlve__huituo")) == "table" and Self:getMark("jlve__huituo") or {}
    local ch = {"回复体力至唯一最多","摸牌至唯一最多","从牌堆或弃牌堆使用装备至装备栏没有空位","获得技能〖恢拓〗"}
    if #mark > 0 then
      for _, m in ipairs(mark) do
        table.removeOne(ch,m)
      end
    end
    return UI.ComboBox {choices = ch}
  end,
}
local huituo = fk.CreateTriggerSkill{
  name = "jlve__huituo",
  anim_type = "support",
  events = {fk.TurnStart},
  can_trigger = function(self, event, target, player, data)
    if not player:hasSkill(self) then return end
    local mark = type(player:getMark("jlve__huituo")) == "table" and player:getMark("jlve__huituo") or {}
    return target == player and player:hasSkill(self) and #mark < 4
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    local mark = type(player:getMark("jlve__huituo")) == "table" and player:getMark("jlve__huituo") or {}
    if #mark >= 4 then return false end
    local _, ret = room:askForUseActiveSkill(player, "jlve__huituo_active", "恢拓：选择一名角色执行选项。", true)
    if _ and ret then
      self.cost_data = ret
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local targetid = self.cost_data.targets[1]
    local choice = self.cost_data.interaction
    local tar = room:getPlayerById(targetid)
    room:doIndicate(player.id,{targetid})
    local mark = type(player:getMark("jlve__huituo")) == "table" and player:getMark("jlve__huituo") or {}
    table.insertIfNeed(mark,choice)
    room:setPlayerMark(player,self.name,mark)
    local ch = {"回复体力至唯一最多","摸牌至唯一最多","从牌堆或弃牌堆使用装备至装备栏没有空位","获得技能〖恢拓〗"}
    if choice == ch[1]  and tar:isWounded() then
      local n = 0
      for _, p in ipairs(room:getOtherPlayers(tar)) do
        if p.hp > n then
          n = p.hp 
        end
      end
      n = n + 1
      if n > tar.hp then
        room:recover{
          who = tar,
          num = math.min(tar.maxHp - tar.hp,n  - tar.hp),
          recoverBy = player,
          skillName = self.name,
        }
      end
    elseif choice == ch[2] then
      local n = 0
      for _, p in ipairs(room:getOtherPlayers(tar)) do
        if p:getHandcardNum() > n then
          n = p:getHandcardNum()
        end
      end
      n = n + 1
      if n > tar:getHandcardNum() then
        tar:drawCards(n - tar:getHandcardNum(),self.name)
      end
    elseif choice == ch[3] then
      for _ = 1, 999, 1 do
        if tar.dead then break end
        local alle = tar:getAvailableEquipSlots()
        local ty = {}
        for _, t in ipairs(alle) do
          if t == Player.WeaponSlot then
            table.insertIfNeed(ty,Card.SubtypeWeapon)
          elseif t == Player.TreasureSlot then
            table.insertIfNeed(ty,Card.SubtypeTreasure)
          elseif t == Player.ArmorSlot then
            table.insertIfNeed(ty,Card.SubtypeArmor)
          elseif t == Player.OffensiveRideSlot then
            table.insertIfNeed(ty,Card.SubtypeOffensiveRide)
          elseif t == Player.DefensiveRideSlot then
            table.insertIfNeed(ty,Card.SubtypeDefensiveRide)
          end
        end
        local cards = {}
        for _, id in ipairs(room.draw_pile) do
          local card = Fk:getCardById(id, true)
          if card.type == Card.TypeEquip and table.contains(ty,card.sub_type) and tar:getEquipment(card.sub_type) == nil and not tar:prohibitUse(card) then
            table.insertIfNeed(cards, id)
          end
        end
        for _, id in ipairs(room.discard_pile) do
          local card = Fk:getCardById(id, true)
          if card.type == Card.TypeEquip and table.contains(ty,card.sub_type) and tar:getEquipment(card.sub_type) == nil and not tar:prohibitUse(card) then
            table.insertIfNeed(cards, id)
          end
        end
        if #cards > 0 then
          room:useCard({
            from = tar.id,
            tos = {{tar.id}},
            card = Fk:getCardById(table.random(cards), true),
          })
          room:delay(300)
        else
          break
        end
      end
    elseif choice == ch[4] then
      room:handleAddLoseSkills(tar,self.name)
    end
  end,
}
Fk:addSkill(huituo_active)
Fk:loadTranslationTable{
  ["jlve__huituo"] = "恢拓",
  ["jlve__huituo_active"] = "恢拓",
  [":jlve__huituo"] = "你的回合开始时，你可以选择以下一个选项移除之，然后令一名角色执行此项：<br>1,将血量回复至全场唯一最多；<br>2,将手牌摸至全场唯一最多；<br>3,从牌堆或弃牌堆使用装备牌至装备栏没有空位;<br>4,获得技能〖恢拓〗。",
  ["$jlve__huituo1"] = "奕世重光，恢拓宏业。",
  ["$jlve__huituo2"] = "重法明理，扬我大魏国威。",
}
local xingshuai = fk.CreateTriggerSkill{
  name = "jlve__xingshuai",
  anim_type = "control",
  events = {fk.Damaged},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self) and data.from and data.from ~= player and #player.room.alive_players > 1
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    local tar = room:askForChoosePlayers(player,table.map(room:getOtherPlayers(player), Util.IdMapper),1,1,"兴衰：选择一名角色，其需选择一项：1，翻面；2，令你获得额外回合。",self.name)
    if #tar > 0 then
      self.cost_data = tar[1]
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local tar = room:getPlayerById(self.cost_data)
    local c1 = "你翻面"
    local c2 = "令 "..Fk:translate(player.general).." 于此回合结束后进行一个额外的回合。"
    local choice = room:askForChoice(tar,{c1,c2},self.name)
    if choice == c1 then
      tar:turnOver()
    elseif choice == c2 then
      player:gainAnExtraTurn(true)
    end
  end,
}
Fk:loadTranslationTable{
  ["jlve__xingshuai"] = "兴衰",
  [":jlve__xingshuai"] = "当你受到其他角色造成的伤害后，你可以令一名其他角色进行选择：<br>1,其翻面；<br>2,令你于此回合结束后进行一个额外的回合。",
  ["$jlve__xingshuai1"] = "朝廷危亡，原卿、助我一臂之力。",
  ["$jlve__xingshuai2"] = "国之兴衰，将军、岂可坐视不理？",
}
local caorui = General(extension, "jlve__caorui","wei",3,3)
caorui:addSkill(huituo)
caorui:addSkill(xingshuai)
Fk:loadTranslationTable{
    ["jlve__caorui"] = "曹叡",

    ["~jlve__caorui"] = "大魏，如何托付..",
}

local manyi = fk.CreateTriggerSkill{
  name = "jlve__manyi",
  anim_type = "drawcard",
  events = {fk.TargetSpecified},
  can_trigger = function(self, event, target, player, data)
    return ((target == player and data.firstTarget) or data.to == player.id )and player:hasSkill(self) and
      (data.card.trueName == "slash" or data.card:isCommonTrick())  and data.card.name ~= "savage_assault"
  end,
  on_cost = function (self, event, target, player, data)
    return player.room:askForSkillInvoke(player,self.name,nil,"蛮裔：是否令此【"..Fk:translate(data.card.name).."】的效果改为【南蛮入侵】并摸一张牌？")
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local use_event = room.logic:getCurrentEvent():findParent(GameEvent.UseCard, true)
    if use_event ~= nil then
      local new_card = Fk:cloneCard("savage_assault", data.card.suit, data.card.number)
    for k, v in pairs(data.card) do
      if new_card[k] == nil then
        new_card[k] = v
      end
    end
    if data.card:isVirtual() then
      new_card.subcards = data.card.subcards
    else
      new_card.id = data.card.id
    end
    new_card.skillNames = data.card.skillNames
    new_card.skill = Fk.skills["savage_assault_skill"]
    data.card = new_card
    use_event.data[1].card = new_card
    local useCardIds = new_card:isVirtual() and new_card.subcards or { new_card.id }
    if #useCardIds > 0 then
      room:sendCardVirtName(useCardIds,"savage_assault")
    end
    end
    if not player.dead then
      player:drawCards(1,self.name)
    end
  end,
}
local souying = fk.CreateTriggerSkill{
  name = "jlve__souying",
  anim_type = "offensive",
  mute = true,
  events = {fk.CardResponding},
  can_trigger = function(self, event, target, player, data)
    if data.card and (data.card.trueName == "slash" or data.card.trueName == "jink") and player:hasSkill(self) then
        return true
    end
  end,
  on_cost = function (self, event, target, player, data)
    if data.card.trueName == "slash" then
      local mark = type(player:getMark(self.name.."1-turn")) == "table" and player:getMark(self.name.."1-turn") or {}
      local tars = {}
      for _, p in ipairs(player.room.alive_players) do
        if not table.contains(mark,p.id) then
          table.insertIfNeed(tars,p.id)
        end
      end
      if #tars <= 0 then return end
      local tar = player.room:askForChoosePlayers(player,tars,1,1,"薮影：你可以对一名本回合未以此法选择过的角色造成1点伤害。",self.name,true)
      if #tar > 0 then
        self.cost_data = tar[1]
        return true
      end
    elseif data.card.trueName == "jink" then
      local mark = type(player:getMark(self.name.."2-turn")) == "table" and player:getMark(self.name.."2-turn") or {}
      local tars = {}
      for _, p in ipairs(player.room.alive_players) do
        if not table.contains(mark,p.id) and p:isWounded() then
          table.insertIfNeed(tars,p.id)
        end
      end
      if #tars <= 0 then return end
      local tar = player.room:askForChoosePlayers(player,tars,1,1,"薮影：你可以令一名本回合未以此法选择过的角色回复1点体力。",self.name,true)
      if #tar > 0 then
        self.cost_data = tar[1]
        return true
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:broadcastSkillInvoke(self.name)
    if data.card.trueName == "slash" then
      local mark = type(player:getMark(self.name.."1-turn")) == "table" and player:getMark(self.name.."1-turn") or {}
      table.insertIfNeed(mark,self.cost_data)
      room:setPlayerMark(player,self.name.."1-turn",mark)
      room:notifySkillInvoked(player,self.name,"offensive")
      room:damage({
        from = player,
        to = room:getPlayerById(self.cost_data),
        damage = 1,
        damageType = fk.NormalDamage,
        skillName = self.name,
      })
    elseif data.card.trueName == "jink" then
      local mark = type(player:getMark(self.name.."2-turn")) == "table" and player:getMark(self.name.."2-turn") or {}
      table.insertIfNeed(mark,self.cost_data)
      room:setPlayerMark(player,self.name.."2-turn",mark)
      room:notifySkillInvoked(player,self.name,"support")
      room:recover{
        who = room:getPlayerById(self.cost_data),
        num = 1,
        recoverBy = player,
        skillName = self.name
        }
    end
  end,
}
local huaman = General(extension, "jlve__huaman","shu",3,3,General.Female)
huaman:addSkill(manyi)
huaman:addSkill(souying)
Fk:loadTranslationTable{
    ["jlve__huaman"] = "花鬘",
    ["jlve__manyi"] = "蛮裔",
    [":jlve__manyi"] = "当你使用【杀】或普通锦囊牌指定目标后，或当你成为其他角色使用【杀】或普通锦囊牌的目标后，你可以令此牌效果改为【南蛮入侵】并摸一张牌。",
    ["jlve__souying"] = "薮影",
    [":jlve__souying"] = "每回合每项对每名角色限一次，当有角色打出【杀】/【闪】时，你可以对一名角色造成一点伤害/令一名角色恢复一点体力。"
}
return extension